package distribuidos.servlet;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import distribuidos.dao.*;
import distribuidos.excepcion.DAOExcepcion;
import distribuidos.modelo.*;


/**
 * Servlet implementation class LoginServlet
 */
@WebServlet("/LoginServlet")
public class LoginServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public LoginServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

		String boton=request.getParameter("tipo");
		String id=request.getParameter("id");
		String id1=request.getParameter("id1");
		HttpSession session = request.getSession();

		RequestDispatcher rd;
		
			  System.out.println(boton);
			  System.out.println(boton+" "+id+ " "+ id1);

				  System.out.println(boton+" "+id+ " "+ id1);
				  id1="";
					request.setAttribute("id", id);
					  session.setAttribute("anuncio1", null);
					  rd=request.getRequestDispatcher("loguin.jsp");
						rd.forward(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {


	/*	HttpSession session = request.getSession();
		  String usuario=request.getParameter("usuario");
		    String contra=request.getParameter("contra"); 
		    session.setAttribute("logueo", lo);
		     request.setAttribute("tipo","P");
		    */

		RequestDispatcher rd;

				    	
				    	 rd=request.getRequestDispatcher("listado.jsp");
		 			    	
	 					 rd.forward(request, response);
				     
           }
			    
	
}
